Skip to content

Harden CI steps - #13236

Merged
phryneas merged 14 commits into
mainfrom
pr/harden-ci
May 27, 2026
Merged

Harden CI steps#13236
phryneas merged 14 commits into
mainfrom
pr/harden-ci

Conversation

@phryneas

@phryneas phryneas commented May 12, 2026

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • New Features

    • Added an automated security analysis workflow to CI.
  • Chores

    • Tightened CI workflow permissions and improved checkout credential handling.
    • Pinned external actions to specific commits for stability.
    • Added a Dependabot cooldown (7-day delay) for npm updates.
    • Introduced concurrency controls for PR prerelease runs and a post-release automation step.
    • Removed an obsolete CI workflow.

@changeset-bot

changeset-bot Bot commented May 12, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 21b677b

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai

coderabbitai Bot commented May 12, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: a5e86e16-0705-40dd-8bcd-91671cb61c6d

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This PR hardens GitHub Actions workflow security by adding explicit minimal permissions, disabling credential persistence, and pinning action versions to commit SHAs across 14 workflows. It introduces a new zizmor security analysis workflow, integrates post-release devtools error code updates into the release workflow (replacing a standalone workflow), and configures Dependabot to delay successive npm update pull requests by 7 days.

Changes

GitHub Actions Security Hardening

Layer / File(s) Summary
Workflow-level permissions and checkout hardening
.github/workflows/api-extractor.yml, arethetypeswrong.yml, cleanup-checks.yml, compare-build-output.yml, docmodel.yml, knip.yml, size-limit.yml
Multiple workflows now declare explicit minimal permissions blocks (typically contents: read) and set persist-credentials: false in checkout steps to prevent credential leakage post-checkout.
Action version pinning to commit SHAs
.github/workflows/api-extractor.yml, arethetypeswrong.yml, cleanup-checks.yml, compare-build-output.yml, docmodel.yml, knip.yml, publish-pr-releases.yml, scheduled-test-canary.yml, size-limit.yml
bahmutov/npm-install action pinned from floating v1 tag to specific commit SHAs across workflows to prevent unexpected behavior changes from action updates.
Isolated checkout and permissions updates
.github/workflows/change-prerelease-tag.yml, copilot-setup-steps.yml, exit-prerelease.yml, prerelease.yml, release.yml, sync-skill.yml, scheduled-test-canary.yml
Additional workflows updated with persist-credentials: false in checkout steps and/or workflow-level permissions blocks; prerelease.yml upgrades actions/create-github-app-token reference comment to v3; release.yml and sync-skill.yml add top-level permissions: {} constraints.
Concurrency control and environment variable refactoring
.github/workflows/publish-pr-releases.yml, scheduled-test-canary.yml
publish-pr-releases.yml adds concurrency configuration to serialize runs per PR/ref; scheduled-test-canary.yml extracts React/React-DOM version from matrix.tag into MATRIX_TAG environment variable.

New Zizmor Security Analysis Workflow

Layer / File(s) Summary
Zizmor GitHub Actions security scanning
.github/workflows/zizmor.yml
New workflow added to run zizmor security analysis on every push to main and all pull requests; includes minimal permissions with security-events: write for SARIF uploads, pinned actions/checkout@v0.5.3, and zizmor action invocation without credential persistence.

Post-Release Devtools Integration

Layer / File(s) Summary
Devtools error code workflow relocation
.github/workflows/release.yml, .github/workflows/devtools-errorcodes.yml
New devtools-errorcodes job added to release.yml as a post-release step that creates a GitHub App token from secret and dispatches update-errorcodes.yml in apollo-client-devtools repo; corresponding standalone devtools-errorcodes.yml workflow removed.

Dependency Management Configuration

Layer / File(s) Summary
Dependabot cooldown policy
.github/dependabot.yml
NPM updates now include a cooldown configuration delaying successive pull requests by 7 days to reduce update noise.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

ci, security, workflows

Suggested reviewers

  • jerelmiller

Poem

🐰 Security workflows now shine so bright,
With pinned versions and permissions tight,
Zizmor scans code with keen rabbit sight,
Devtools updates flow in the night,
All credentials safe—our CI done right!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Harden CI steps' directly and clearly describes the main objective of the PR—improving security and robustness of CI/GitHub Actions workflows through permissions restrictions, credential management, and action pinning.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@pkg-pr-new

pkg-pr-new Bot commented May 12, 2026

Copy link
Copy Markdown
npm i https://pkg.pr.new/apollographql/apollo-client/@apollo/client@13236

commit: 21b677b

@github-advanced-security

Copy link
Copy Markdown

You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool.

What Enabling Code Scanning Means:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

Comment thread .github/workflows/release.yml Fixed
Comment thread .github/workflows/release.yml Fixed
Comment thread .github/workflows/release.yml Fixed
@phryneas
phryneas marked this pull request as ready for review May 12, 2026 17:09

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
.github/workflows/release.yml (1)

172-172: ⚡ Quick win

Inconsistent version comment formatting.

The version comments at lines 172 and 178 use #v3 and #v1 without a space before the version number. This is inconsistent with the formatting used in other workflow files (e.g., line 32 uses # v6, line 46 uses # v6, line 58 uses # v1) and in prerelease.yml line 25 which uses # v3.

📝 Proposed fix for formatting consistency
-      - uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 `#v3`
+      - uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3
-      - uses: benc-uk/workflow-dispatch@7a027648b88c2413826b6ddd6c76114894dc5ec4 `#v1`
+      - uses: benc-uk/workflow-dispatch@7a027648b88c2413826b6ddd6c76114894dc5ec4 # v1

Also applies to: 178-178

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/release.yml at line 172, Update the inline version comment
formatting to include a space before the version number for consistency; change
the comment on the
actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3
occurrence (currently "#v3") to "# v3" and similarly change the other action
comment (the one flagged as "#v1") to "# v1" so all workflow action comments
match the existing "# vX" style used elsewhere.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/change-prerelease-tag.yml:
- Line 43: The workflow currently sets persist-credentials: false which prevents
the GitHub App token from being stored and makes the later git push (the step
that runs git push) fail; fix by either removing the persist-credentials: false
setting from the checkout step so the token provided by
steps.github-actions-bot-app-token.outputs.token persists for subsequent git
operations, or keep persist-credentials: false but add a git remote
reconfiguration before the push (run a command to set origin to
https://x-access-token:${{ steps.github-actions-bot-app-token.outputs.token
}}@github.com/${{ github.repository }}) so the push uses the App token; apply
the same change to the other affected workflows (prerelease.yml and
exit-prerelease.yml) as well.

In @.github/workflows/exit-prerelease.yml:
- Line 38: The workflow sets actions/checkout with persist-credentials: false
which prevents credentials from being available for the subsequent git push;
before the git push step (the push command referenced in the workflow) either
re-configure git credentials by setting the origin URL to include the token from
steps.github-actions-bot-app-token.outputs.token (using git remote set-url
origin https://x-access-token:${{
steps.github-actions-bot-app-token.outputs.token }}@github.com/${{
github.repository }}) or remove persist-credentials: false from the
actions/checkout invocation so credentials are persisted; update the workflow to
perform one of these fixes so the git push succeeds.

---

Nitpick comments:
In @.github/workflows/release.yml:
- Line 172: Update the inline version comment formatting to include a space
before the version number for consistency; change the comment on the
actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3
occurrence (currently "#v3") to "# v3" and similarly change the other action
comment (the one flagged as "#v1") to "# v1" so all workflow action comments
match the existing "# vX" style used elsewhere.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: e97bea3d-b1e1-4761-8fec-e8ae7a9bfa9c

📥 Commits

Reviewing files that changed from the base of the PR and between d4a28b6 and ded9ad3.

📒 Files selected for processing (18)
  • .github/dependabot.yml
  • .github/workflows/api-extractor.yml
  • .github/workflows/arethetypeswrong.yml
  • .github/workflows/change-prerelease-tag.yml
  • .github/workflows/cleanup-checks.yml
  • .github/workflows/compare-build-output.yml
  • .github/workflows/copilot-setup-steps.yml
  • .github/workflows/devtools-errorcodes.yml
  • .github/workflows/docmodel.yml
  • .github/workflows/exit-prerelease.yml
  • .github/workflows/knip.yml
  • .github/workflows/prerelease.yml
  • .github/workflows/publish-pr-releases.yml
  • .github/workflows/release.yml
  • .github/workflows/scheduled-test-canary.yml
  • .github/workflows/size-limit.yml
  • .github/workflows/sync-skill.yml
  • .github/workflows/zizmor.yml
💤 Files with no reviewable changes (1)
  • .github/workflows/devtools-errorcodes.yml

Comment thread .github/workflows/change-prerelease-tag.yml Outdated
Comment thread .github/workflows/exit-prerelease.yml Outdated
@apollo-librarian

apollo-librarian Bot commented May 13, 2026

Copy link
Copy Markdown
Contributor

✅ Docs preview has no changes

The preview was not built because there were no changes.

Build ID: 6f878c58f5a8b9c13b1a5cd8
Build Logs: View logs


✅ AI Style Review — No Changes Detected

No MDX files were changed in this pull request.

Review Log: View detailed log

This review is AI-generated. Please use common sense when accepting these suggestions, as they may not always be accurate or appropriate for your specific context.

Comment thread .github/workflows/prerelease.yml Fixed
Comment thread .github/workflows/release.yml Fixed
node-version: ">=23.6.0"

- name: Install dependencies (with cache)
uses: bahmutov/npm-install@v1

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we even use this action anymore? actions/setup-node has a built-in cache so might be best to use that one. Thoughts?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very happy if we get rid of it, I just didn't want to do everything in one PR

- name: Run comparison script
id: attw
run: ./config/compare-build-output-to.sh $(git merge-base HEAD origin/${{ github.base_ref }}) | tee $GITHUB_STEP_SUMMARY
run: ./config/compare-build-output-to.sh $(git merge-base HEAD origin/${GITHUB_BASE_REF}) | tee $GITHUB_STEP_SUMMARY

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of curiosity, whats the difference here and why is the env variable better?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was an autofix if I remember correctly, so I didn't dig too deep into this, but apparently {{ }} can be used for command injection into the command being built while env variables get expanded by the shell. So if you had ; or | in your branch name, you could start a new command I guess?

@jerelmiller jerelmiller May 26, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will we need to manually trigger this in future releases?

Edit: Nevermind, I see it added to a different workflow below

@jerelmiller jerelmiller left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally looks good! Had a few questions, but let's get this in.

@phryneas
phryneas enabled auto-merge (squash) May 27, 2026 08:08
app-id: 819772
private-key: ${{ secrets.APOLLO_GITHUB_ACTIONS_BOT_PRIVATE_KEY }}
repositories: apollo-client-devtools
- uses: benc-uk/workflow-dispatch@7a027648b88c2413826b6ddd6c76114894dc5ec4 # v1
@phryneas
phryneas merged commit 414f927 into main May 27, 2026
49 of 50 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants